-- WMS: nastaveni pevneho vyberu sektoru v davce
<g>
update sectorSelect set useric = 1105, useru = 0, ts0 = getdate(), a251914u11011 = 0
from
  a179102u11011 sectorSelect
  inner join a139311u11011 batchKind on sectorSelect.ic_a = batchKind.ic_a and sectorSelect.u_a = batchKind.u_a and a251914u11011 is null
  inner join a201477u11011 sectorDef on batchKind.ic_b = sectorDef.ic_a and batchKind.u_b = sectorDef.u_a and sectorDef.ic_b = sectorSelect.ic_b and sectorDef.u_b = sectorSelect.u_b and a202768u11011 = 1
</g>

-- WMS: generovat davky + spusteni davky
<g>
update a139128u11011 set useric = 1105, useru = 0, a208304u11011 = IsNull(a208304u11011, 0) | 16
where (a208304u11011 is not null and (a208304u11011 & 16 <> 16)) or (a208304u11011 is null and a167269u11011 = 1)
</g>